<?php

require_once('../library/Quad/Bootstrap.php');

$begin = microtime(true);
$app = new Quad_Bootstrap('rewrite');

$form = new Quad_Form();
$input = new Quad_Form_Element_Text('textlabel', '1');
$form->testText = $input;

$form->textarea = new Quad_Form_Element_Textarea('textarea label', '2');
$form->file = new Quad_Form_Element_File('file label', '3');

$form->select = new Quad_Form_Element_Select('select label', 2);
$opts = array(
	1=>'one',
	2=>'two',
	3=>'three',
);
$opts = array();
for ($i = 1; $i < 100; ++$i) {
	$opts[$i] = "option $i";
}
$form->select->setOptions($opts);

$form->testRadios = new Quad_Form_Element_RadioGroup('radio group', 'b');
$opts = array(
	'a'=>'aee',
	'b'=>'bee',
	'c'=>'cee',
);
$form->testRadios->setOptions($opts);

$form->testCboxes = new Quad_Form_Element_CheckboxGroup('checkbox group', 'ii');
$opts = array(
	'i'=>'roman 1',
	'ii'=>'roman 2',
	'iii'=>'roman 3',
);
$form->testCboxes->setOptions($opts);
$form->testCboxes->setLayout('tr');
$form->testCboxes->addDecorator('table');
//Quad_Debug::dumpdie($form->testRadios);

//foreach ($form->testRadios->getOptions() as $r) {
//	echo $r;
//}
//die();
//Quad_Debug::dumpdie((string) $form->testRadios);

echo $form;
//echo '<pre>' . htmlentities($form);
//echo '<pre>' . htmlentities(str_replace("><",">\n<",$form->select));
$time = round((microtime(true) - $begin) * 1000, 2);
echo "elapsed: {$time}ms"; 

?>
<hr />
<br />
<form id="form2">
	<input type="radio" name="hi" value="1" /> radio1<br />
	<input type="radio" name="hi" value="2" /> radio2
</form>

<select id="oman">
	<option value="1">1</option>
	<optgroup label="2">
		<option value="2.1">2.1</option>
		<option value="2.2">2.2</option>
	</optgroup>
	<optgroup label="3">
		<option value="3.1">3.1</option>
		<option value="3.2">3.2</option>
	</optgroup>
	<option value="4">4</option>	
</select>